home *** CD-ROM | disk | FTP | other *** search
/ EnigmA Amiga Run 1996 February / EnigmA AMIGA RUN 04 (1996)(G.R. Edizioni)(IT)[!][issue 1996-02][Skylink CD III].iso / earcd / util1 / yk211src.lha / Yak_2.11_Src / Include / Hotkey_types.h < prev    next >
C/C++ Source or Header  |  1995-10-18  |  6KB  |  248 lines

  1. /*
  2.  * Definitions for generic Yak hotkeys.
  3.  * mws, 27 April 1993
  4.  */
  5.  
  6. #ifndef HOTKEY_TYPES_H
  7. #define HOTKEY_TYPES_H
  8.  
  9. #ifndef EXEC_TYPES_H
  10. #include <exec/types.h>
  11. #endif /* EXEC_TYPES_H */
  12.  
  13. #ifndef EXEC_NODES_H
  14. #include <exec/nodes.h>
  15. #endif /* EXEC_NODES_H */
  16.  
  17. #ifndef EXEC_LISTS_H
  18. #include <exec/lists.h>
  19. #endif /* EXEC_LISTS_H */
  20.  
  21. #ifndef LIBRARIES_COMMODITIES_H
  22. #include <libraries/commodities.h>
  23. #endif /* LIBRARIES_COMMODITIES_H */
  24.  
  25.  
  26. /*
  27.  * YakOption structure definition
  28.  */
  29. typedef struct {
  30.     UWORD   Flags;
  31.     STRPTR *ArgStr;
  32.     LONG   *ArgNum;
  33. } YakOption;
  34.  
  35.  
  36. /*
  37.  * YakHotKey structure definition
  38.  */
  39. typedef struct {
  40.         struct Node      yhk_Node;      /* node for linked-list */
  41.         CxObj           *yhk_CxObj;     /* cx object list */
  42.         UWORD            yhk_Type;      /* hotkey type */
  43.         char            *yhk_KeyDef;    /* actual key definition */
  44.         UWORD            yhk_State;     /* hotkey state  */
  45.         char            *yhk_Name;      /* hotkey name */
  46.         YakOption       *yhk_Option;    /* hotkey options */
  47. } YakHotKey;
  48.  
  49.  
  50. #define EMPTY_MINLIST {NULL,NULL,NULL}
  51.  
  52. /*
  53.  * Types of hotkey currently supported
  54.  */
  55.  
  56. #define EXECUTE_COMMAND      0
  57. #define CLOSE_WINDOW         1
  58. #define ZIP_WINDOW           2
  59. #define SHRINK_WINDOW        3
  60. #define EXPAND_WINDOW        4
  61. #define MOVE_WINDOW          5
  62. #define CYCLE_WINDOWS        6
  63. #define OPEN_PALETTE         7
  64. #define SCREEN_TO_FRONT      8
  65. #define SCREEN_TO_BACK       9
  66. #define CENTRE_SCREEN        10
  67. #define ACTIVATE_WORKBENCH   11
  68. #define BLANK_DISPLAY        12
  69. #define INSERT_TEXT          13
  70. #define INSERT_DATE          14
  71. #define SHOW_INTERFACE       15
  72. #define SET_DEF_PUB_SCREEN   16
  73. #define MENU_SHORTCUT        17
  74. #define NUM_HOTKEY_TYPES     18
  75.  
  76.  
  77. /*
  78.  * YakHotKey states.
  79.  */
  80. #define YKHK_INACTIVE 0
  81. #define YKHK_ACTIVE   1
  82. #define NUM_STATES    2
  83.  
  84. /*
  85.  * YakHotKey click types.
  86.  */
  87. #define YKHK_SIMPLE   0
  88. #define YKHK_DOUBLE   1
  89. #define YKHK_TRIPLE   2
  90. #define NUM_CLICKS    3
  91.  
  92.  
  93. /*
  94.  * This structure describes an option of a hotkey
  95.  */
  96.  
  97. typedef struct {
  98.     UBYTE     Type;
  99.     UWORD     LocalID;
  100. #ifdef PREFS
  101.     APTR      LabelID;
  102.     UWORD     ExcludeIDs;
  103.     UWORD     ActivateIDs;
  104.     UWORD     DisplayID;
  105. #endif
  106. #if defined(PREFS) || defined(CONV)
  107.     UWORD     DefFlag;
  108.     STRPTR    DefArgStr;
  109.     LONG      DefArgNum;
  110. #endif
  111. } OptDescription;
  112.  
  113.  
  114. /* Types */
  115. #define NO_OPT      0
  116. #define TOGGLE_OPT  1
  117. #define STRING_OPT  2
  118. #define INTEGER_OPT 3
  119.  
  120.  
  121. typedef struct {
  122.     OptDescription *Desc;
  123. #ifdef PREFS
  124.     APTR            LabelID;
  125. #endif
  126. } OptsList;
  127.  
  128.  
  129. /*
  130.  * YakHotKeyType structure
  131.  */
  132. typedef struct {
  133.         struct MinList yhkt_list;                    /* list of keys */
  134. #if defined(PREFS) || defined(CONV)
  135.         APTR           yhkt_nameID;                  /* locale string identifier for name */
  136. #else
  137.         void         (*yhkt_Command)(YakHotKey *);   /* command to call */
  138. #endif 
  139. #ifdef PREFS
  140.         char          *yhkt_HelpNode;                /* online help */
  141. #endif
  142.         UWORD          yhkt_OptsNum;
  143.         OptsList      *yhkt_OptsList;
  144. } YakHotKeyType;
  145.  
  146.  
  147. /*
  148.  * Options
  149.  */
  150.  
  151. GLOBAL OptDescription ChangeScreenHKOption[];
  152.  
  153. /* Change Screen */
  154. #define HKO_NO_SCREEN_CHANGE         (1<<0)
  155. #define HKO_WORKBENCH_TO_FRONT       (1<<1)
  156. #define HKO_DEFAULT_PUBSCR_TO_FRONT  (1<<2)
  157.  
  158. /* Commands */
  159. #define HKO_CLI_COMMAND        (1<<0)
  160. #define HKO_AREXX_COMMAND      (1<<1)
  161. #define HKO_STACK_COMMAND      (1<<2)
  162. #define HKO_PRIORITY_COMMAND   (1<<3)
  163. #define HKO_COMMAND            (1<<4)
  164. #define HKO_AREXX_PORT         (1<<5)
  165.  
  166. /* Select Window & Screen */
  167. #define HKO_ACTIVE          (1<<0)
  168. #define HKO_UNDER_MOUSE     (1<<1)
  169. #define HKO_BY_TITLE        (1<<2)
  170. #define HKO_PATTERN         (1<<3)
  171. #define HKO_REARMOST        (1<<4)        /* Screen To Front */
  172. #define HKO_FRONTMOST       (1<<5)        /* Screen To Back */
  173.  
  174. /* Resize Window */
  175. #define HKO_RESIZE_HORIZONTAL  (1<<0)
  176. #define HKO_RESIZE_VERTICAL    (1<<1)
  177. #define HKO_RESIZE_VISIBLE_BAR (1<<2)
  178.  
  179. /* Move Window & Screen */
  180. #define HKO_NO_VERTICAL_MOVING     (1<<0)
  181. #define HKO_MOVE_TOP               (1<<1)
  182. #define HKO_MOVE_VERTICAL_CENTER   (1<<2)
  183. #define HKO_MOVE_BOTTOM            (1<<3)
  184. #define HKO_NO_HORIZONTAL_MOVING   (1<<4)
  185. #define HKO_MOVE_LEFT              (1<<5)
  186. #define HKO_MOVE_HORIZONTAL_CENTER (1<<6)
  187. #define HKO_MOVE_RIGHT             (1<<7)
  188. #define HKO_MOVE_VISIBLE_BAR       (1<<8)  /* Move Window */
  189. #define HKO_MOVE_VISIBLE_ACTIVE    (1<<8)  /* Move Screen */
  190.  
  191. /* Cycle Windows */
  192. #define HKO_BACK_CYCLE             (1<<0)
  193. #define HKO_EXCLUDE_WB_DRAWERS     (1<<1)
  194. #define HKO_BY_WINDOW_TASK_NAME    (1<<2)
  195. #define HKO_TASK_NAME_PATTERN      (1<<3)
  196. #define HKO_ACTIVATE_ONLY          (1<<4)
  197.  
  198. /* Insert Date */
  199. #define HKO_DATE_FORMAT   (1<<0)
  200.  
  201. /* Insert Text */
  202. #define HKO_INSERT_STRING (1<<0)
  203. #define HKO_INSERT_DELAY  (1<<1)
  204.  
  205. /* Menu */
  206. #define HKO_MENU_NUMBER    (1<<0)
  207. #define HKO_ITEM_NUMBER    (1<<1)
  208. #define HKO_SUBITEM        (1<<2)
  209. #define HKO_SUBITEM_NUMBER (1<<3)
  210.  
  211.  
  212.  
  213.  
  214.  
  215.  
  216. /*
  217.  * Info for anyone to examine
  218.  */
  219. extern YakHotKeyType yhktypes[NUM_HOTKEY_TYPES];
  220. extern UWORD num_hkeys;
  221.  
  222. #define YHK_Takes_Opt(yhk)  (yhktypes[(yhk)->yhk_Type].yhkt_OptsNum)
  223.  
  224. #define keylist(type)       ((struct List *)&yhktypes[type].yhkt_list)
  225. #define numkeys(type)       yhktypes[type].yhkt_count
  226.  
  227.  
  228.  
  229.  
  230.  
  231. /*
  232.  * And functions for anyone to call
  233.  */
  234. void PerformAction(YakHotKey *yhk);
  235. void DeleteYakHotKey(YakHotKey *yhk);
  236. int ModifyYHKKeyDef(YakHotKey *yhk, char *keystr);
  237. int ModifyYHKName(YakHotKey *yhk, char *namestr);
  238. YakHotKey *NewYakHotKey(UWORD type);
  239. void InitYakHotKeyList(void);
  240. void DeleteYakHotKeyList(void);
  241. APTR ControlYakHotKey(YakHotKey *yhk);
  242. int OkayToExit(void);
  243. char *DupStr(char *str);
  244.  
  245. void DefaultOptions(YakHotKey *yhk);
  246.  
  247. #endif
  248.